/**
 * @(#) CongMoneyMediator.as
 *
 * @date		2009. 03. 25.
 * @version		1.0
 * @author		baek, kwang hyoun
 * @description	건강보험증 신청 - Mediator
 * 				건강보험증을 조회하고 신청하는 Presentation Logic을 관리
 */
package com.skt.common_hr.reguide.view
{
	import com.skt.common_hr.common.Variables;
	import com.skt.common_hr.common.puremvc.OverViewMediator;
	import com.skt.common_hr.reguide.view.components.ReguideOverView;
	
	import flash.events.Event;
	
	import mx.collections.ArrayCollection;
	
	import org.puremvc.as3.multicore.interfaces.INotification;

	public class ReguideMediator extends OverViewMediator
	{
		public static const NAME:String = "bankreqMediator";


		/**
		* 생성자
		*
		* @param
		* @return void
		*/
        public function ReguideMediator( viewComponent:Object )
        {
            super( NAME, viewComponent );
        }

		/**
		* View를 초기화 한다.
		*	- View에 기본사항을 출력하고 data를 load
		* @param
		* @return void
		* 최초 한번만 불림
		*/
 		override protected function initializeView():void
 		{
			super.initializeView();
 		}
		/***
		 * 활성화가 될때마다 불림.
		 */
		override protected function activatedView():void
		{
			super.activatedView();
			
			view.vsMain.selectedIndex = 0;
			view.treeMenu.selectedIndex = 1;
		}

// 		override protected function clearView():void
// 		{
// 			view.vsCompensation.selectedIndex = 0;
// 			view.tb.selectedIndex = 0;
//			//loadProfile();
// 		}
 		
		override protected function closedView():void
		{
			removeEventListener();
		}

 		private function setEventListener():void
 		{
// 			view.addEventListener(HthIcFacade.HthIcWrite, onClickNew);
//			view.addEventListener(gwarekeyEvent.SELECT_DATA, onClickReadOnly);
//			view.addEventListener(gwarekeyEvent.UPDATE_DATA, onClickModify);
//			view.addEventListener(gwarekeyEvent.DELETE_DATA, onClickDelete);
//			view.addEventListener(gwarekeyEvent.PRINT_DATA, onStatementView);
 		}

 		private function removeEventListener():void
 		{
//			view.removeEventListener(HthIcFacade.HthIcWrite, onClickNew);
//			view.removeEventListener(gwarekeyEvent.SELECT_DATA, onClickReadOnly);
//			view.removeEventListener(gwarekeyEvent.UPDATE_DATA, onClickModify);
//			view.removeEventListener(gwarekeyEvent.DELETE_DATA, onClickDelete);
//			view.removeEventListener(gwarekeyEvent.PRINT_DATA, onStatementView);
 		}


 		private function loadList():void
 		{
// 			var mProxy:MedicalMoneyProxy = facade.retrieveProxy(MedicalMoneyProxy.NAME) as MedicalMoneyProxy;
//			mProxy.loadList(Variables.myPernr);
 		}


		///////////////////////////////////////////////////////////////////////////////////////////////////
		//
		//	Process MVC Messages
		//
		///////////////////////////////////////////////////////////////////////////////////////////////////
		/**
		* 본 Class에서 처리해야할 Noti들을 등록한다.
		*
		* @param
		* @return void
		*/
		override public function listNotificationInterests():Array
		{
			return basicInterestMessages;
		}


		/**
		* Noti별로 처리한다.
		*
		* @param
		* @return void
		*/
		override public function handleNotification(note:INotification):void
		{
			super.handleNotification(note);
			switch(note.getName())
			{
				
			}
		}


 		/**
		 * Proxy에서 DataLoad를 완료한 후 호출됨
		 *     - load된 데이터를 화면에 출력
		 * @param
		 * @return void
		 */
 		private function setListView(list:ArrayCollection):void
 		{
// 			view.medicalMoneyDataList = list;
// 			commonFacade.setStatusMessage("STATUS_LOADED_LIST", [list.length.toString()]);
// 			if(list.length == 0) {
// 				view.showInitialTip();
// 			}
 		}


		///////////////////////////////////////////////////////////////////////////////////////////////////
		//
		//	Event handler (from View, Internal or....)
		//
		///////////////////////////////////////////////////////////////////////////////////////////////////

		/**
		 * 클릭시 단순 조회
		 * @param
		 * @return void
		 */
 		

 		/**
		 * 신규 신청 및 수정 화면 실행
		 * @param
		 * @return void
		 */
 		private function executeReqView(param:Object):void
 		{
// 			commonFacade.setStatusMessage("");
//			view.vsMain.selectedIndex = 1;
//
// 			var writeMediator:ReqHthIcMediator = facade.retrieveMediator(ReqHthIcMediator.NAME) as ReqHthIcMediator;
// 			if(!writeMediator) {
//				writeMediator = new ReqHthIcMediator(view.hthIcWriteView);
//	 			facade.registerMediator(writeMediator);
//			}
 			//if(writeMediator) facade.sendNotification(HthIcFacade.LOAD_HTHIC_WRITE_INITIAL, param);
 		}

 		/**
		 * 삭제 버튼 클릭시 실행
		 * @param
		 * @return void
		 */
// 		private function onClickDelete(event:gwarekeyEvent):void
// 		{
// 			//var mmProxy:MedicalMoneyProxy = facade.retrieveProxy(MedicalMoneyProxy.NAME) as MedicalMoneyProxy;
//			//mmProxy.deleteData(event.key, event.wstatus);
// 		}
//
// 		/**
//		 * 전표조회
//		 * @param
//		 * @return void
//		 */
// 		private function onStatementView(event:gwarekeyEvent):void
// 		{
// 			//var statementProxy:StatementUrlProxy = facade.retrieveProxy(StatementUrlProxy.NAME) as StatementUrlProxy;
//			//statementProxy.load(event.key.toString());
// 		}

		///////////////////////////////////////////////////////////////////////////////////////////////////
		//
		//	Utility Functions
		//
		///////////////////////////////////////////////////////////////////////////////////////////////////
 		private function findCodeIndex(key:String, srcArr:ArrayCollection):int
		{
			for(var i:int=0; i<srcArr.length; i++) {
				if(srcArr[i].data == key) {
					return i;
				}
			}
			return -1;
		}

       private function get view():ReguideOverView
        {
            return viewComponent as ReguideOverView;
        }


	}
}